<html>
<head><meta charset="utf-8"><title>i1 for function pointer in LLVM output? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/i1.20for.20function.20pointer.20in.20LLVM.20output.3F.html">i1 for function pointer in LLVM output?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205885427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/i1%20for%20function%20pointer%20in%20LLVM%20output%3F/near/205885427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/i1.20for.20function.20pointer.20in.20LLVM.20output.3F.html#205885427">(Aug 04 2020 at 09:00)</a>:</h4>
<p>I see this line in LLVM output of a crate: (context: <a href="https://github.com/rust-lang/rust/issues/75089">https://github.com/rust-lang/rust/issues/75089</a>)</p>
<div class="codehilite"><pre><span></span><code>; core::fmt::num::imp::&lt;impl core::fmt::Display for i32&gt;::fmt
; Function Attrs: nounwind
declare zeroext i1 @&quot;_ZN4core3fmt3num3imp52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$3fmt17h9ba9fea9cadf7bd5E&quot;(i32* noalias readonly align 4 dereferenceable(4), %&quot;core::fmt::Formatter&quot;* align 4 dereferenceable(36)) unnamed_addr #1
</code></pre></div>


<p>I'm confused about the <code>i1</code> part here. I don't understand LLVM syntax in details, but I think this is declaring address of a function, but the type is <code>i1</code> which is just one bit? This can't be right. Am I missing anything? What exactly does this line declare?</p>



<a name="205915572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/i1%20for%20function%20pointer%20in%20LLVM%20output%3F/near/205915572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/i1.20for.20function.20pointer.20in.20LLVM.20output.3F.html#205915572">(Aug 04 2020 at 14:44)</a>:</h4>
<p>that's the return type.</p>



<a name="205916985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/i1%20for%20function%20pointer%20in%20LLVM%20output%3F/near/205916985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/i1.20for.20function.20pointer.20in.20LLVM.20output.3F.html#205916985">(Aug 04 2020 at 14:54)</a>:</h4>
<p>Interesting.. how can it return a single bit value for <code>Result&lt;(), Error&gt;</code>? It takes two arguments so I think it's not taking an argument for the return value <code>Error</code>either.</p>



<a name="205917242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/i1%20for%20function%20pointer%20in%20LLVM%20output%3F/near/205917242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/i1.20for.20function.20pointer.20in.20LLVM.20output.3F.html#205917242">(Aug 04 2020 at 14:56)</a>:</h4>
<p><code>Error</code> is a ZST, so you only need 1 bit to represent the result</p>



<a name="205917753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/i1%20for%20function%20pointer%20in%20LLVM%20output%3F/near/205917753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/i1.20for.20function.20pointer.20in.20LLVM.20output.3F.html#205917753">(Aug 04 2020 at 15:00)</a>:</h4>
<p>Makes sense, thanks.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>